home *** CD-ROM | disk | FTP | other *** search
Text File | 1992-07-15 | 2.3 KB | 85 lines | [TEXT/MPS ] |
- ***********************************************************************
- ***
- *** Patch KeyTrans AKA Dead Key Killer
- ***
- ***********************************************************************
-
- STRING ASIS
- PRINT OFF
- INCLUDE 'Traps.a'
- INCLUDE 'SysEqu.a'
- PRINT ON
-
-
-
- KeyTrans EQU $A9C3
-
- ******************************** Entry *******************************
-
- PatchKeyTrans PROC EXPORT
-
- EXPORT OrigAddr
-
- bra.s theDude
-
- ******************************** MyKeyTrans *******************************
-
- MyKeyTrans
- bset.b #7,9(sp) ;set the up/down bit - KeyTrans won't process
- ; "dead" up strokes. Currently, this does not
- ; affect the event record up/down state.
- move.l OrigAddr,-(sp) ;push original KeyTrans address
- rts ; and rts to it
-
- OrigAddr DC.L 0 ;a place for the old KeyTrans address
-
- KTEnd
-
- ******************************** MainDude *******************************
-
- UnImpTrap EQU $A89F
-
- theDude
-
- movem.l d0/a0-a2,-(sp) ;save some regs
- move.l #KTEnd-MyKeyTrans,d0 ;size up a block for the sys heap
- _newPtr ,Clear ;clean bytes, please
- bne.s abort ;if'n it didn't work, give up
- move.l a0,a2 ;keep our new ptr around for later
-
- move.w #KeyTrans,d0 ;get trap word of KeyTrans
- _GetTrapAddress ,NEWTOOL ;get the original address
- bne.s abort ;if error, bail out - this shouldn't happen
- lea OrigAddr,a1 ;point to our storage
- move.l a0,(a1) ;save old address
- beq.s abort ;abort if not a valid pointer
-
- movea.l a2,a1 ;set up destination ptr for blockmove
- lea MyKeyTrans,a0 ;set up source ptr for blockmove
- move.l #KTEnd-MyKeyTrans,d0 ;size up hpw many bytes to move
- _blockMove ;and moof 'em
-
- movea.l a2,a0 ;get a pointer to our routine
- move.w #KeyTrans,d0 ;get trap word of KeyTrans
- _SetTrapAddress ,NEWTOOL ;set to our routine
-
- exit movem.l (sp)+,d0/a0-a2 ;restore some regs
- rts
- abort _debugger
- rts
-
- ENDP
-
- UnPatch PROC EXPORT
-
- IMPORT OrigAddr
-
-
- movem.l d0/a0,-(sp) ;save some regs
- movea.l OrigAddr,a0 ;get a pointer to original routine
- move.w #KeyTrans,d0 ;get trap word of KeyTrans
- _SetTrapAddress ,NEWTOOL ;set to original routine
- movem.l (sp)+,d0/a0 ;restore some regs
- rts
-
- END